<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserLoginLogs extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_login_logs', function (Blueprint $table) {
            $table->charset = 'utf8';
            $table->collation = 'utf8_general_ci';
            $table->comment = '用户登录log日志';
            $table->bigIncrements('id');
            $table->unsignedInteger('user_id')->comment('用户id')->index();
            $table->unsignedTinyInteger('login_type')->comment('登录方式:1手机账号登录，2微信授权登录');
            $table->string('ip',100)->comment('登录ip');
            $table->unsignedInteger('login_total')->default(1)->comment('登录次数');
            $table->timestamp('login_time')->comment('登陆日期');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_login_logs');
    }
}
